package com.kongfanyu.springcloud.controller;

import com.kongfanyu.springcloud.domain.Order;
import com.kongfanyu.springcloud.entities.CommonResult;
import com.kongfanyu.springcloud.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Copyright (C), 2018-2020
 * FileName: OrderController
 * Author:   kongfanyu
 * Date:     2020/9/6 13:32
 */
@Slf4j
@RestController
public class OrderController {
    @Resource
    private OrderService orderService;

    @PostMapping("/order/create")
    public CommonResult create(Order order){
        log.info("开始创建订单:" + order);
        orderService.create(order);
        log.info("结束创建订单:" + order);
        return new CommonResult(200,"订单创建成功");
    }
}
